package com.bdsy.business.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bdsy.business.dao.ScaveRecordMapper;
import com.bdsy.business.model.ScaveRecord;
import com.bdsy.business.service.ScaveRecordService;
import com.bdsy.common.utils.DateUtil;

@Service("scaveRecordService")
public class ScaveRecordServiceImpl implements ScaveRecordService{

	@Autowired
	ScaveRecordMapper scaveRecordMapper;
	
	@Override
	public boolean insert(ScaveRecord scaveRecord) {
		scaveRecord.setId((int)((Math.random()*9+1)*10000000));
		scaveRecord.setScanTime(DateUtil.getCurrentDate());
		int rusult = scaveRecordMapper.insert(scaveRecord);
		return rusult>0?true:false;
	}

	@Override
	public List<Map> selectScaveRecordById(String userId) {
		@SuppressWarnings("rawtypes")
		List<Map> scaveRecordList= scaveRecordMapper.selectScaveRecordById(userId);
		return scaveRecordList;
	}

	@Override
	public int count(String userId) {
		int record = scaveRecordMapper.count(userId);
		return record;
	}

}
